package red.ouo.distributedtools.config;


import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;
import red.ouo.distributedtools.redis.service.RedisMessage;

import javax.annotation.Resource;

@Configuration
public class ApplicationConfig implements CommandLineRunner {
    @Resource
    RedisMessage.Handler<String> handler;

    @Override
    public void run(String... args) {
        /**
         * 测试订阅Redis简单消息队列
         */
        handler.fetchSome("test", 3, (s, t) -> {
            System.out.println("收到消息" + s);
        });
    }
}